// 按需引入ant Design ui 的组件
import { Button, message, ConfigProvider, Spin, Form, Input, Layout, Menu, Icon, Modal, Table, Divider } from 'ant-design-vue'
import * as Icons from '@ant-design/icons-vue'
const icons = Icons
import { createFromIconfontCN } from '@ant-design/icons-vue'
// 新增一个额外的icon组件，icon来源是阿里巴巴的inconfont
const IconFont = createFromIconfontCN({
  scriptUrl: '//at.alicdn.com/t/font_2775863_dvxisohb3eq.js'
})

/**注册使用组件
 * @param:app 全局创建的
 */
export function installComponents(app) {
  app.config.productionTip = false
  app.config.globalProperties.$message = message
  // 引入所有icon图标标签
  for (const i in icons) {
    app.component(i, icons[i])
  }
  app.use(Button)
  app.use(ConfigProvider)
  app.use(Spin)
  app.use(Form)
  app.use(Input)
  app.use(Layout)
  app.use(Menu)
  app.use(Icon)
  app.component('icon-font', IconFont)
  app.use(Modal)
  app.config.globalProperties.$confirm = Modal.confirm
  app.use(Table)
  app.use(Divider)
}
